home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Graphics / Plotting / aa_Intel_Only / Gnuplot / GnuplotSource / SeriesTicsPane.m < prev    next >
Encoding:
Text File  |  1995-06-12  |  2.3 KB  |  110 lines

  1. /*
  2.  *  Copyright (C) 1993  Robert Davis
  3.  *
  4.  *  This program is free software; you can redistribute it and/or
  5.  *  modify it under the terms of Version 2, or any later version, of 
  6.  *  the GNU General Public License as published by the Free Software 
  7.  *  Foundation.
  8.  */
  9.  
  10.  
  11. static char RCSId[]="$Id: SeriesTicsPane.m,v 1.5 1993/05/04 16:22:42 davis Exp $";
  12.  
  13. #import <appkit/Application.h>
  14. #import <appkit/Form.h>
  15. #import <appkit/FormCell.h>
  16. #import <appkit/View.h>
  17.  
  18. #import "SeriesTicsPane.h"
  19. #import "Status.h"
  20. #import "StatusTics.h"
  21. #import "TicOptionsPanel.h"
  22.  
  23.  
  24. @implementation SeriesTicsPane
  25.  
  26. - init
  27. {
  28.     [super init];
  29.  
  30.     [NXApp loadNibSection: "SeriesTicsPane.nib"
  31.             owner: self
  32.         withNames: NO
  33.          fromZone: [self zone]];
  34.  
  35.     return self;
  36. }
  37.  
  38.  
  39.  
  40. - (BOOL)updateStatus:aStatus doc:aDoc
  41. {
  42.     BOOL    enabled;
  43.  
  44.     [super updateStatus:aStatus doc:aDoc];
  45.  
  46.     enabled = status && doc;
  47.     if (enabled) {
  48.     int    coord = [doc coord];
  49.  
  50.     [startField setDoubleValue:[status ticStartCoord:coord]];
  51.     [incrementField setDoubleValue:[status ticIncrementCoord:coord]];
  52.     [endField setDoubleValue:[status ticEndCoord:coord]];
  53.     }
  54.  
  55.     [startField setEnabled:enabled];
  56.     [incrementField setEnabled:enabled];
  57.     [endField setEnabled:enabled];
  58.  
  59.     return NO;
  60. }
  61.  
  62.  
  63. - selectControl:sender
  64. {
  65.     [seriesForm selectText:self];
  66.     return self;
  67. }
  68.  
  69.  
  70. - setTicsSeries:sender
  71. {
  72.     int        coord = [doc coord];
  73.     double    start = [startField doubleValue];
  74.     double    incr = [incrementField doubleValue];
  75.     double    end = [endField doubleValue];
  76.     int        index = [sender selectedIndex];
  77.  
  78.     /*
  79.      *  The increment must take us from the start to the end.  And the
  80.      *  end must be larger than the start (gnuplot help says this is
  81.      *  not true, but it doesn't seem to work otherwise).
  82.      */
  83. //    if (((start + incr) <= start) || (start >= end))
  84.     if (((start + incr) <= start) || (start >= end))
  85.      [self forceUpdateStatus:status doc:doc];
  86.  
  87.     else {
  88.      FormCell *selectedCell = [sender selectedCell];
  89.  
  90.      if (selectedCell == startField)
  91.          [status setTicStartCoord:coord to:start];
  92.      else if (selectedCell == incrementField)
  93.          [status setTicIncrementCoord:coord to:incr];
  94.      else
  95.          [status setTicEndCoord:coord to:end];
  96.     }
  97.  
  98.     return self;
  99. }
  100.  
  101.  
  102. // Shuts up the compiler about unused RCSId
  103. - (const char *) rcsid
  104. {
  105.     return RCSId;
  106. }
  107.  
  108.  
  109. @end
  110.